<template>
	<view class="header">
		<view class="header_box_radio" v-if="num == 0">
			<view :class="['radio_box', active == index ? 'active' : '' ]" v-for="(item,index) in option"
				@click="changeActive(index)">
				{{ item }}
			</view>
		</view>
		<view class="header_box_lease_status" v-else-if="num == 1">
			<view :class="['status_box', active == index ? 'active' : '' ]" v-for="(item,index) in option"
				@click="changeActive(index)">
				{{ item }}
			</view>

		</view>
		<view class="header_box" v-else>
			<view :class="['option_box', active == index ? 'active' : '' ]" v-for="(item,index) in option"
				@click="changeActive(index)">
				{{ item }}
			</view>
		</view>
	</view>
</template>

<script>
	export default {

		props: {
			isno: {
				type:[Boolean],
				 default: false
			},
			num: {
				type: [Number, String],
				value: 0
			},
			active: {
				type: [Number, String],
				value: 0
			},
			option: {
				type: Array,
				default: () => {
					return ['合租', "整租", ]
				}
			}
		},
		data() {
			return {
				// active: 0,
			}
		},
		methods: {
			changeActive(index) {
				if(this.isno) return 
				// this.active = index;
				this.$emit("change", index)
			},
		},
	}
</script>

<style lang="scss" scoped>
	@import "@/styles/global.scss";
	@import "@/styles/index.scss";

	.active {
		background-color: $theme !important;
		color: #fff !important;
	}

	.header {
		.header_box {
			display: flex;
			justify-content: center;
			// margin-top: 30rpx;

			.option_box {
				display: inline-block;
				padding: 8rpx 40rpx;
				border: 1px solid $theme;
				color: $theme;
				background-color: #fff;
				font-size: 30rpx;
				border-radius: 5rpx;
				// @include boxshadow;
			}

		}

		.header_box_radio {
			// margin-top: 50rpx;
			display: flex;
			justify-content: center;
			gap: 4%;
			padding: 0 8%;
			box-sizing: border-box;
			width: 100%;
			.radio_box {
				display: inline-block;
				padding: 12rpx 50rpx;
				border: 1px solid $pagebgc;
				color: $noimportant;
				background-color: $pagebgc;
				font-size: 30rpx;
				border-radius: 15rpx;
				@include flexCenter;

				// @include textOverflow
			}
		}

		.header_box_lease_status {
			width: 100%;
			height: 140rpx;
			// background-color: blue;
			box-sizing: border-box;
			font-size: 30rpx;
			.status_box {
				height: 50%;
				width: 50%;
				float: left;
				@include flexCenter;
				border-collapse: collapse;
				border: 1rpx solid #eee;
				box-sizing: border-box;
				border-collapse: collapse;
			}
		}
	}
</style>